import java.util.Scanner;

public class Test1 {
    /**
     * 构成单词的字符只有26个大写或小写英文字母；
     * 2、非构成单词的字符均视为单词间隔符；
     * 3、要求倒排后的单词间隔符以一个空格表示；如果原字符串中相邻单词间有多个间隔符时，倒排转换后也只允许出现一个空格间隔符；
     * 4、每个单词最长20个字母；
     *
     * I am a student
     *
     * student a am
     * @param
     */

    public static boolean idContain(char ch){
        return ('a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z');
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()){
            String str = scanner.nextLine();
            char[] ch = str.toCharArray();

            for (int i = 0; i < ch.length; i++) {
                if(!idContain(ch[i])){
                    ch[i] = ' ';
                }
            }
            str = new String(ch);
            //将字符串以空格分成字符串数组
            String[] str1 = str.split(" ");
            StringBuilder stringBuilder = new StringBuilder();
            for (int i = str1.length - 1; i >= 0 ; i--) {
                stringBuilder.append(str1[i] + " ");
            }
            //trim是用来去除前后空格用的
            System.out.println(stringBuilder.toString().trim());
        }
    }
}
